<dependency> <groupId>org.switchyard.components</groupId> <artifactId>switchyard-component-camel-mail</artifactId> <version>SWITCHYARD-VERSION</version> </dependency>
The mail binding in SwitchYard provides support for consuming and sending mail messages. It supports both sides - service binding for mail consumption and reference for message sending.
The Mail binding is built on top of camel-mail and supports most of options for this endpoint. Please reffer camel documentation for detailed description of them.
This binding have it's own namespace. To use it you must declare namespace with uri urn:switchyard-component-camel-mail:config:1.0. Your Maven project should also have following dependency:
<dependency> <groupId>org.switchyard.components</groupId> <artifactId>switchyard-component-camel-mail</artifactId> <version>SWITCHYARD-VERSION</version> </dependency>
Following options can be apiled to <binding.mail> definition:
host
port
username
password
connectionTimeout
Additional attribute secure may be used to identify usage of secured connection (pop3s/imaps/smtps) instead.
Supported options are:
folderName
fetchSize
unseen
delete
copyTo
disconnect
Additional attribute accountType may be specified to choose mail protocol. Possible values are pop3 or imap. Default is imap.
Here's an example of what a mail service binding looks like:
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0"> <sca:service name="GreetingService" promote="GreetingService"> <camel:binding.mail> <camel:host>localhost</camel:host> <camel:username>camel</camel:username> <camel:consume accountType="pop3"> <camel:copyTo>after-processing</camel:copyTo> </camel:consume> </camel:binding.mail> </sca:service> </sca:composite>
Binding a reference with mail can be used to send outgoing message. The following configuration options are available for binding.mail when binding references:
subject
from
to
CC
BCC
replyTo
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0"> <sca:reference name="GreetingService" promote="camel-binding/GreetingService" multiplicity="1..1"> <camel:binding.mail> <camel:host>localhost</camel:host> <camel:username>camel</camel:username> <camel:produce> <camel:subject>Forwarded message</camel:subject> <camel:from>camel@localhost</camel:from> <camel:to>rider@camel</camel:to> </camel:produce> </camel:binding.mail> </sca:reference> </sca:composite>